package com.zl.gmadmin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zl.gmadmin.common.BaseEntity;
import io.swagger.annotations.ApiModel;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Objects;


/**
 * <p>
 * 部门
 * </p>
 *
 * @author zl
 * @since 2021-02-22
 */
@TableName("sys_dept")
@ApiModel(value = "部门表")
public class SysDept extends BaseEntity {


    /**
     * ID
     */
    @TableId(value = "dept_id", type = IdType.AUTO)
    private Long id;

    /**
     * 上级部门
     */
    private Long pid;

    /**
     * 子部门数目
     */
    private Integer subCount;

    /**
     * 名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 排序
     */
    private Integer deptSort;

    /**
     * 状态
     */
    private Boolean enabled;

//    /**
//     * 创建者
//     */
//    private String createBy;
//
//    /**
//     * 更新者
//     */
//    private String updateBy;
//
//    /**
//     * 创建日期
//     */
//    private LocalDateTime createTime;
//
//    /**
//     * 更新时间
//     */
//    private LocalDateTime updateTime;

    /**
     * 部门存在用户总数
     */
    @TableField(exist = false)
    private Long deptExistsUsersCount;
    /**
     * 当前部门最大排序加1
     */
    @TableField(exist = false)
    private Long sameLevelDeptMaxSort;

    public Long getSameLevelDeptMaxSort() {
        return sameLevelDeptMaxSort;
    }

    public void setSameLevelDeptMaxSort(Long sameLevelDeptMaxSort) {
        this.sameLevelDeptMaxSort = sameLevelDeptMaxSort;
    }

    public Long getDeptExistsUsersCount() {
        return deptExistsUsersCount;
    }

    public void setDeptExistsUsersCount(Long deptExistsUsersCount) {
        this.deptExistsUsersCount = deptExistsUsersCount;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Integer getSubCount() {
        return subCount;
    }

    public void setSubCount(Integer subCount) {
        this.subCount = subCount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getDeptSort() {
        return deptSort;
    }

    public void setDeptSort(Integer deptSort) {
        this.deptSort = deptSort;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    @Override
    public String getCreateBy() {
        return super.getCreateBy();
    }

    @Override
    public void setCreateBy(String createBy) {
        super.setCreateBy(createBy);
    }

    @Override
    public String getUpdateBy() {
        return super.getUpdateBy();
    }

    @Override
    public void setUpdateBy(String updateBy) {
        super.setUpdateBy(updateBy);
    }

    @Override
    public LocalDateTime getCreateTime() {
        return super.getCreateTime();
    }

    @Override
    public void setCreateTime(LocalDateTime createTime) {
        super.setCreateTime(createTime);
    }

    @Override
    public LocalDateTime getUpdateTime() {
        return super.getUpdateTime();
    }

    @Override
    public void setUpdateTime(LocalDateTime updateTime) {
        super.setUpdateTime(updateTime);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o){ return true;}
        if (o == null || getClass() != o.getClass()){ return false;}
        SysDept sysDept = (SysDept) o;
        return Objects.equals(id, sysDept.id) &&
                Objects.equals(pid, sysDept.pid) &&
                Objects.equals(subCount, sysDept.subCount) &&
                Objects.equals(name, sysDept.name) &&
                Objects.equals(deptSort, sysDept.deptSort) &&
                Objects.equals(enabled, sysDept.enabled);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, pid, subCount, name, deptSort, enabled);
    }


}
